home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / graphics / gnuplot / term / hp26.trm < prev    next >
Text File  |  1993-09-15  |  16KB  |  622 lines

  1. /*
  2.  * $Id: hp26.trm%v 3.50 1993/07/09 05:35:24 woo Exp $
  3.  */
  4.  
  5. /* GNUPLOT - HP26.trm */
  6. /*
  7.  * Copyright (C) 1990   
  8.  *
  9.  * Permission to use, copy, and distribute this software and its
  10.  * documentation for any purpose with or without fee is hereby granted, 
  11.  * provided that the above copyright notice appear in all copies and 
  12.  * that both that copyright notice and this permission notice appear 
  13.  * in supporting documentation.
  14.  *
  15.  * Permission to modify the software is granted, but not the right to
  16.  * distribute the modified code.  Modifications are to be distributed 
  17.  * as patches to released version.
  18.  *  
  19.  * This software  is provided "as is" without express or implied warranty.
  20.  * 
  21.  * This file is included by ../term.c.
  22.  *
  23.  * This terminal driver supports:
  24.  *  HP2623A 
  25.  *
  26.  * AUTHORS
  27.  *   luecken@udel.edu (Bruce Lueckenhoff) 
  28.  *   hplvlch!ch (Chuck Heller) 
  29.  * 
  30.  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  31.  * 
  32.  */
  33.  
  34.  
  35. #define HP26_XMAX 512
  36. #define HP26_YMAX 390
  37.  
  38. #define HP26_XLAST (HP26_XMAX - 1)
  39. #define HP26_YLAST (HP26_XMAX - 1)
  40.  
  41. /* Use a size 1 character, or a 7 x 10 grid. */
  42. #define HP26_VCHAR    10
  43. #define HP26_HCHAR    7
  44. #define HP26_VTIC    5
  45. #define HP26_HTIC    5
  46.  
  47. /* include the stream compaction routines */
  48. #include "compact.c"
  49.  
  50. typedef struct _HP26_Buffer_Node{
  51.     int index;
  52.     int size;
  53.     int next;
  54.     int linetype;
  55.     int *x;
  56.     int *y;
  57.     TBOOLEAN *isa_move;
  58. } HP26_Buffer_Node;
  59.  
  60. /* constructor method */
  61. HP26_Buffer_Node *BN_create(index, size, linetype)
  62. int index, size, linetype;
  63. {
  64.     HP26_Buffer_Node *the_node;
  65.     the_node = (HP26_Buffer_Node *) malloc(sizeof(HP26_Buffer_Node));
  66.     the_node->index = index;
  67.     the_node->linetype = linetype;
  68.     the_node->size = size;
  69.     the_node->next = 0;
  70.     the_node->x = (int *) calloc(the_node->size, sizeof(int));
  71.     the_node->y = (int *) calloc(the_node->size, sizeof(int));
  72.     the_node->isa_move = (TBOOLEAN *)calloc(the_node->size,sizeof(TBOOLEAN));
  73.     if (the_node->x == NULL 
  74.       ||the_node->y == NULL 
  75.       ||the_node->isa_move == NULL)
  76.         return (NULL);
  77.     else
  78.         return(the_node);
  79. }
  80.  
  81. /* destructor method */
  82. void BN_delete(the_node)
  83. HP26_Buffer_Node *the_node;
  84. {
  85.     free(the_node->x);
  86.     free(the_node->y);
  87.     free(the_node->isa_move);
  88.     free(the_node);
  89. }
  90.  
  91. /* 2 for border and axes + 9 for plots + 1 for dots */
  92. #define HP26_gnu_map_size 12
  93. HP26_Buffer_Node *HP26_gnu_map[HP26_gnu_map_size];
  94. HP26_Buffer_Node *HP26_buff;
  95. int HP26_pen_x;
  96. int HP26_pen_y;
  97. int HP26_angle;
  98. int HP26_cursor_x;
  99. int HP26_cursor_y;
  100. TBOOLEAN HP26_in_text;
  101. int HP26_linetype_current;
  102. int HP26_reduction_int;
  103. int HP26_reduction_slope;
  104. int HP26_overflows;
  105. int HP26_nop_move;
  106. int HP26_nop_vect;
  107. int HP26_nop_line;
  108.  
  109. /* linetype stuff */
  110. #define    SOLID    1
  111. #define    USER    2
  112. #define LINE3    3
  113. #define LINE4    4
  114. #define LINE5    5
  115. #define LINE6    6
  116. #define    DOTS    7
  117. #define LINE8    8
  118. #define LINE9    9
  119. #define LINE10    10
  120. #define POINT    11
  121.  
  122.  
  123.  
  124. #define swap(a, b) a ^= b; b ^= a; a ^= b;
  125.  
  126. char HP26_bin_short_table[32]={
  127. '0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?',
  128. ' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/'};
  129. /* encodes an integer (assumed to be in range) into 
  130.    binary short incremental format (j)*/
  131. #define short_encode(n) (HP26_bin_short_table[n+16])
  132.  
  133. /* tells whether a given delta_x,delta_y pair can be expressed in
  134.    binary short incremental format */
  135. #define qualified(dx,dy) ((dx>-17)&&(dy>-17)&&(dx<16)&&(dy<16))
  136.  
  137.  
  138. char HP26_bin_table[32]={
  139. ' ','!','"','#','$','%','&','\'','(',')','*','+',',','-','.','/',
  140. '0','1','2','3','4','5','6','7','8','9',':',';','<','=','>','?'};
  141. /* returns the high byte of integer n in binary absolute format (i) */
  142. #define bin_encode_hi(n) (HP26_bin_table[n>>5]) 
  143. /* returns the low byte of integer n in binary absolute format (i) */
  144. #define bin_encode_lo(n) (HP26_bin_table[n & 31]) 
  145.  
  146.  
  147.  
  148. /* the guts of the program 
  149. -- first checks if any work need be done and, failing that, returns 
  150.     immediately
  151. -- tries to compress the vector stream
  152. -- goes through the buffer, using binary short incremental (2 bytes/point) 
  153.     as much as possible, even if must output two pairs to express one vector
  154.     (it's no more expensive, and will hopefully damp any excessive switching
  155.     back and forth between the two formats)
  156.     if can't use binary short incremental, use binary 
  157.     absolute(4 bytes/point)
  158. -- finally, resets the HP26_next pointer to zero    */
  159. HP26_flush(the_buff)
  160. HP26_Buffer_Node *the_buff;
  161. {
  162.     int i, delta_x, delta_y, half_dx, half_dy;
  163.     int *buff_x, *buff_y;
  164.     TBOOLEAN *isa_move;
  165.     TBOOLEAN bin_short;
  166.  
  167.     if (the_buff->next == 0)
  168.         return (FALSE);
  169.     /* init pointers for easy access */
  170.     buff_x = the_buff->x;
  171.     buff_y = the_buff->y;
  172.     isa_move = the_buff->isa_move;
  173.     if (HP26_in_text){
  174.         fputs("\033*dT", outfile);
  175.         HP26_in_text = FALSE;
  176.     }
  177.     if (HP26_linetype_current != the_buff->linetype
  178.         && (the_buff->next > 1 || !isa_move[0])){
  179.         fprintf(outfile,"\033*m%dB",the_buff->linetype);
  180.         HP26_linetype_current = the_buff->linetype;
  181.     }
  182.     /* try to compress the stream */
  183.     if (the_buff->next>30 && the_buff->linetype != POINT){
  184. /*        HP26_reduction_int += compact_int(buff_x,buff_y,isa_move, &(the_buff->next));    */
  185.         HP26_reduction_slope += compact_slope(buff_x,buff_y,isa_move, &(the_buff->next),0.1); 
  186.     }
  187.  
  188.     /* start escape sequence */
  189.     fputs("\033*p",outfile);
  190.     /* initialize the state:  binary short incremental or binary absolute */
  191.     delta_x = buff_x[0] - HP26_pen_x;
  192.     delta_y = buff_y[0] - HP26_pen_y;
  193.     if (qualified(delta_x, delta_y)){
  194.         fputc('j', outfile);
  195.         bin_short = TRUE;
  196.     }else{
  197.         fputc('i', outfile);
  198.         bin_short = FALSE;
  199.     }
  200.     /* now work through the list */
  201.     for (i=0;i<the_buff->next;i++){
  202.         if (i>0){
  203.             delta_x = buff_x[i] - buff_x[i-1];
  204.             delta_y = buff_y[i] - buff_y[i-1];
  205.         }
  206.         if ((delta_x==0)&&(delta_y==0)){
  207.             if (i>0 && !isa_move[i-1] && !isa_move[i]){
  208.                 /* allow null vectors only when drawing dots */
  209.                 HP26_nop_vect++;
  210.                 continue;
  211.             }else if (isa_move[i]){
  212.                 /* a null move */
  213.                 HP26_nop_move++;
  214.                 continue;
  215.             }
  216.         }else if (i > 0
  217.             && i+1 <the_buff->next
  218.             && isa_move[i]
  219.             && isa_move[i+1]){
  220.             /* consecutive moves are condensed into one */
  221.             HP26_nop_move++;
  222.             continue;
  223.         }else if (!qualified(delta_x, delta_y)
  224.           && i > 0
  225.           && i + 2 < the_buff->next
  226.           && isa_move[i]
  227.           && !isa_move[i+1]
  228.           && isa_move[i+2]
  229.           &&qualified(buff_x[i+1]-buff_x[i-1],buff_y[i+1]-buff_y[i-1])){
  230.             swap(buff_x[i], buff_x[i+1]);
  231.             swap(buff_y[i], buff_y[i+1]);
  232.             /* set up new delta_x & delta_y */
  233.             delta_x = buff_x[i] - buff_x[i-1];
  234.             delta_y = buff_y[i] - buff_y[i-1];
  235.         }
  236.         if (qualified(delta_x,delta_y)){
  237.             if (!bin_short){
  238.                 fputc ('j',outfile);
  239.                 bin_short = TRUE;
  240.             }
  241.             if (isa_move[i])
  242.                 fputc ('a',outfile);
  243.             fputc(short_encode(delta_x), outfile);
  244.             fputc(short_encode(delta_y), outfile);
  245.         }else{
  246.             half_dx = (delta_x + (delta_x>0 ? 1 : -1))/2;
  247.             half_dy = (delta_y + (delta_y>0 ? 1 : -1))/2;
  248.             if (bin_short && qualified(half_dx,half_dy)){
  249.                 if (isa_move[i])
  250.                     fputc('a',outfile);
  251.                 fputc(short_encode(half_dx), outfile);
  252.                 fputc(short_encode(half_dy), outfile);
  253.                 if (isa_move[i])
  254.                     fputc('a',outfile);
  255.                 fputc(short_encode(delta_x - half_dx), outfile);
  256.                 fputc(short_encode(delta_y - half_dy), outfile);
  257.             }else{ 
  258.                 if (bin_short){
  259.                     bin_short = FALSE;
  260.                     fputc('i',outfile);
  261.                 }
  262.                 if (isa_move[i])
  263.                     fputc('a',outfile);
  264.                 fputc(bin_encode_hi(buff_x[i]), outfile);
  265.                 fputc(bin_encode_lo(buff_x[i]), outfile);
  266.                 fputc(bin_encode_hi(buff_y[i]), outfile);
  267.                 fputc(bin_encode_lo(buff_y[i]), outfile);
  268.             }
  269.         }
  270.     }    /* end for.. */
  271.     /* the term doesn't seem to mind leaving this out */
  272.     /* finish the escape sequence */
  273.     fputc ('Z',outfile);
  274.     /* set these for next time */
  275.     HP26_pen_x = buff_x[the_buff->next - 1];
  276.     HP26_pen_y = buff_y[the_buff->next - 1];
  277.     the_buff->next = 0;
  278.     return(TRUE);
  279. }
  280.  
  281. HP26_handle_overflow()
  282. {
  283.     HP26_Buffer_Node *bigger, *old;
  284.     int x, y;
  285.     x = (HP26_buff->x)[HP26_buff->next - 1];
  286.     y = (HP26_buff->y)[HP26_buff->next - 1];
  287.     HP26_flush(HP26_buff);
  288.     bigger = BN_create(HP26_buff->index, HP26_buff->size * 2,
  289.         HP26_buff->linetype);
  290.     if (bigger != NULL){
  291.         old = HP26_buff;
  292.         HP26_gnu_map[bigger->index] = bigger;
  293.         /* special case since DOTS entry is shared 3 ways */
  294.         if(bigger->index == 0){
  295.             HP26_gnu_map[1] = bigger;
  296.             HP26_gnu_map[3] = bigger;
  297.         }
  298.         HP26_buff = bigger;
  299.         BN_delete(old);
  300.     }
  301.     (HP26_buff->x)[0] = x;
  302.     (HP26_buff->y)[0] = y;
  303.     (HP26_buff->isa_move)[0] = TRUE;
  304.     HP26_buff->next = 1;
  305.     HP26_overflows++;
  306. }
  307.  
  308. /* checks for NOP, overcapacity condition, and then adds vector to the list */
  309. HP26_vector(x,y)
  310. int x,y;
  311. {
  312.     if (HP26_buff->next > 2
  313.       && x == (HP26_buff->x)[HP26_buff->next-1]
  314.       && y == (HP26_buff->y)[HP26_buff->next-1]
  315.       && !(HP26_buff->isa_move)[HP26_buff->next-1] ){
  316.         HP26_nop_vect++;
  317.         return(FALSE);
  318.     }
  319.     if (HP26_buff->next == HP26_buff->size)
  320.         HP26_handle_overflow();
  321.     /* otherwise add to the list */
  322.     (HP26_buff->x)[HP26_buff->next] = x;
  323.     (HP26_buff->y)[HP26_buff->next] = y;
  324.     (HP26_buff->isa_move)[HP26_buff->next] = FALSE;
  325.     HP26_buff->next++;
  326. }
  327.  
  328. /* checks for NOP, checks for overcapacity, puts self on list */
  329. HP26_move(x,y)
  330. int x,y;
  331. {
  332.     if (HP26_buff->next > 0){
  333.         if (((HP26_buff->x)[HP26_buff->next - 1] == x)
  334.           &&((HP26_buff->y)[HP26_buff->next - 1] == y)){
  335.             /* null moves are NOP's */
  336.             HP26_nop_move++;
  337.             return (FALSE);
  338.         }else if ((HP26_buff->isa_move)[HP26_buff->next-1]){
  339.             /* consecutive moves are NOP's */
  340.             (HP26_buff->x)[HP26_buff->next-1] = x;
  341.             (HP26_buff->y)[HP26_buff->next-1] = y;
  342.             HP26_nop_move++;
  343.             return (TRUE);
  344.         }
  345.     }
  346.     if (HP26_buff->next == HP26_buff->size)
  347.         HP26_handle_overflow();
  348.     (HP26_buff->x)[HP26_buff->next] = x;
  349.     (HP26_buff->y)[HP26_buff->next] = y;
  350.     (HP26_buff->isa_move)[HP26_buff->next] = TRUE;
  351.     HP26_buff->next++;
  352.     return (TRUE);
  353. }
  354.  
  355. HP26_init()
  356. {
  357.     HP26_gnu_map[-2 + 2] = BN_create( 0, 2048, DOTS);    /* border */
  358.     HP26_gnu_map[-1 + 2] = HP26_gnu_map[-2 + 2];        /* axes */
  359.     HP26_gnu_map[ 0 + 2] = BN_create( 2, 3072, SOLID);    /* plot 0 */
  360.     HP26_gnu_map[ 1 + 2] = HP26_gnu_map[-2 + 2];        /* plot 1 */
  361.     HP26_gnu_map[ 2 + 2] = BN_create( 4, 1024, LINE5);    /* plot 2 */
  362.     HP26_gnu_map[ 3 + 2] = BN_create( 5,  256, LINE6);    /* plot 3 */
  363.     HP26_gnu_map[ 4 + 2] = BN_create( 6,  256, LINE8);    /* plot 4 */
  364.     HP26_gnu_map[ 5 + 2] = BN_create( 7,  128, LINE9);    /* plot 5 */
  365.     HP26_gnu_map[ 6 + 2] = BN_create( 8,  128, LINE10);    /* plot 6 */
  366.     HP26_gnu_map[ 7 + 2] = BN_create( 9,   64, LINE6);    /* plot 7 */
  367.     HP26_gnu_map[ 8 + 2] = BN_create(10,   64, LINE4);    /* plot 8 */
  368.     HP26_gnu_map[ 9 + 2] = BN_create(11,  512, POINT);    /* point plot */
  369.     HP26_buff = HP26_gnu_map[10];    /* set to an unlikely linetype */
  370.     HP26_linetype_current = 0;    /* set to force a linetype change */
  371.     HP26_angle = 1;            /* left to right, default */
  372.     fputs("\033*mp1m2a2Q",outfile);
  373.     /*           1 2 3 4
  374.     1.  make text upright
  375.     2.  select text size 1
  376.     3.  make SET the default drawing op
  377.     4.  left justify text */
  378.     fflush (outfile);
  379. }
  380.  
  381.  
  382. HP26_graphics()
  383. {
  384.     fputs("\033*daflsC", outfile);
  385.     /*           12345
  386.     1.  clear graphics display
  387.     2.  shut off the alphanumeric display 
  388.     3.  graphics cursor off
  389.     4.  into graphics text mode
  390.     5.  enable graphics display */
  391.     /* set the pen & cursor positions to force an initial absolute move */
  392.     HP26_pen_x     = HP26_pen_y    = -200;
  393.     HP26_cursor_x    = HP26_cursor_y    = 800;
  394.     HP26_in_text = TRUE;
  395.     /* initialize statistics */
  396.     HP26_reduction_int = 0; 
  397.     HP26_reduction_slope = 0;
  398.     HP26_nop_move = 0;
  399.     HP26_nop_vect = 0;
  400.     HP26_nop_line = 0;
  401.     HP26_overflows = 0;
  402. }
  403.  
  404.  
  405. HP26_text()
  406. {
  407.     int i, j, curr;
  408.  
  409.     /* always flush the current line first */
  410.     for (i=0;i<HP26_gnu_map_size;i++)
  411.         if ((HP26_gnu_map[i])->linetype == HP26_linetype_current)
  412.             HP26_flush(HP26_gnu_map[i]);
  413.     /* now flush the rest of the lines */
  414.     for (i=0;i<HP26_gnu_map_size;i++){
  415.         HP26_flush(HP26_gnu_map[i]);
  416.         curr = HP26_gnu_map[i] -> linetype;
  417.         for (j=0;j<HP26_gnu_map_size;j++)
  418.             if ((HP26_gnu_map[j])->linetype == curr)
  419.                 HP26_flush(HP26_gnu_map[j]);
  420.     }
  421.     fputs("\033*deT",outfile);
  422.     /*           12
  423.     1. turn on the alphanumeric display
  424.     2. back to text mode */
  425.     fflush(outfile);
  426.     /* informational:  tells how many points compressed, how
  427.        many NOP's of each type, and how many times a buffer
  428.        overflowed during this plot */
  429.     /*
  430.     if(HP26_reduction_int
  431.          + HP26_reduction_slope
  432.          + HP26_nop_move
  433.          + HP26_nop_vect
  434.          + HP26_overflows
  435.          + HP26_nop_line > 0){
  436.         if (HP26_reduction_int>0)
  437.             printf("%d int-compress",HP26_reduction_int);
  438.         if (HP26_reduction_slope>0)
  439.             printf("%d slope-compress",HP26_reduction_slope);
  440.         if (HP26_nop_move>0)
  441.             printf("  %d nop_move",HP26_nop_move);
  442.         if (HP26_nop_vect>0)
  443.             printf("  %d nop_vect",HP26_nop_vect);
  444.         if (HP26_nop_line>0)
  445.             printf("  %d nop_line",HP26_nop_line);
  446.         if (HP26_overflows>0)
  447.             printf("  %d buffer overflows",HP26_overflows);
  448.         printf("\n");
  449.     }
  450.     */
  451. }
  452.  
  453. HP26_reset()
  454. {
  455.     int i;
  456.     for (i=0;i<HP26_gnu_map_size;i++)
  457.         BN_delete(HP26_gnu_map[i]);
  458. }
  459.  
  460. HP26_text_angle (ang)
  461. int ang;
  462. {
  463.     HP26_angle = ang + 1;
  464.     fprintf(outfile,"\033*m%dN",HP26_angle);
  465.     return(TRUE);
  466. }
  467.  
  468.  
  469. HP26_put_text(x, y,str)
  470. int x, y;
  471. char *str;
  472. {
  473.     char abs_str[10],rel_str[10];
  474.  
  475.     if (!strlen(str))
  476.         return(FALSE);
  477.     else{
  478.         fputs("\033*d", outfile);
  479.         if (!HP26_in_text){
  480.             fputc('s', outfile);
  481.             HP26_in_text = TRUE;
  482.         }
  483.         sprintf(rel_str,"%d,%dP",x - HP26_cursor_x, y - HP26_cursor_y);
  484.         sprintf(abs_str,"%d,%dO", x, y);
  485.         if (strlen(rel_str) < strlen(abs_str))
  486.             fputs(rel_str, outfile);
  487.         else
  488.             fputs(abs_str, outfile);
  489.         fputs(str, outfile);
  490.         HP26_pen_x = HP26_cursor_x = x;
  491.         HP26_pen_y = HP26_cursor_y = y;
  492.     }
  493.     /*
  494.         tmp = &(HP26_all_buffers[HP26_linetype_current]);
  495.         tmp->x[tmp->next] = x;
  496.         tmp->y[tmp->next] = y;
  497.         tmp->isa_move[tmp->next] = TRUE;
  498.         tmp->next++;
  499.         HP26_flush(tmp);
  500.         fprintf(outfile,"\033*l%s\r",str);
  501.     */
  502.     return(TRUE);
  503. }
  504.  
  505.  
  506. /* checks for NOP, sets HP26_buff to point to the right buffer */
  507. HP26_linetype(linetype)
  508. int linetype;
  509. {
  510.     if (linetype > 8)
  511.         linetype %= 9;
  512.     linetype += 2;
  513.     if (HP26_gnu_map[linetype] == HP26_buff){
  514.         HP26_nop_line++;
  515.         return (FALSE);    /* gnuplot just sent us another NOP */
  516.     }
  517.     HP26_buff = HP26_gnu_map[linetype];
  518.     return (TRUE);
  519. }
  520.  
  521.  
  522.  
  523. /* switches to a solid linetype and calls do_point, then switches back */
  524. HP26_line_and_point(x,y,number)
  525. int x,y,number;
  526. {
  527.     int line_save,not_solid;
  528.  
  529.     not_solid = (HP26_buff->linetype != SOLID);
  530.     if (not_solid){
  531.         line_save = HP26_buff->linetype;
  532.         HP26_linetype (0);  /*switch to a solid line*/
  533.     }
  534.     HP26_do_point(x, y, number);
  535.     if (not_solid)
  536.         HP26_linetype(line_save);
  537.     return (TRUE);
  538. }
  539.  
  540.  
  541. /* provides 9 point types so they stay in sync with the linetypes 
  542. puts simpler point types first on the assumption they are more
  543. frequently used */
  544. HP26_do_point (x, y,number)
  545. int x, y,number;
  546. {
  547.     int htic,vtic;
  548.     HP26_Buffer_Node *tmp;
  549.  
  550.     vtic = HP26_VTIC/2;
  551.     htic = HP26_HTIC/2;
  552.     if (number<0){
  553.         /* do a dot -- special case */
  554.         tmp = HP26_buff;
  555.         HP26_buff = HP26_gnu_map[11];    /* point plot */
  556.         HP26_vector(x, y);
  557.         HP26_buff = tmp;
  558.         return(TRUE);
  559.     }
  560.     switch (number % 9){
  561.         case 0:
  562.             /* do triangle */
  563.             HP26_move(x-htic, y-vtic);
  564.             HP26_vector(x, y+vtic);
  565.             HP26_vector(x+htic, y-vtic);
  566.             HP26_vector(x-htic, y-vtic);
  567.             break;
  568.         case 1:
  569.             /* do nambla */
  570.             HP26_move(x-htic, y+vtic);
  571.             HP26_vector(x, y-vtic);
  572.             HP26_vector(x+htic, y+vtic);
  573.             HP26_vector(x-htic, y+vtic);
  574.             break;
  575.         case 2:
  576.             /* do left triangle */
  577.             HP26_move(x-htic, y);
  578.             HP26_vector(x+htic, y+vtic);
  579.             HP26_vector(x+htic, y-vtic);
  580.             HP26_vector(x-htic, y);
  581.             break;
  582.         case 3:
  583.             /* do right triangle */
  584.             HP26_move(x+htic, y);
  585.             HP26_vector(x-htic, y+vtic);
  586.             HP26_vector(x-htic, y-vtic);
  587.             HP26_vector(x+htic, y);
  588.             break;
  589.         case 4:
  590.             /* do box */
  591.             HP26_move(x-htic, y-vtic);
  592.             HP26_vector(x-htic, y+vtic);
  593.             HP26_vector(x+htic, y+vtic);
  594.             HP26_vector(x+htic, y-vtic);
  595.             HP26_vector(x-htic, y-vtic);
  596.             break;
  597.         case 5:
  598.             /* do plus */
  599.             HP26_move(x, y+vtic);
  600.             HP26_vector(x, y-vtic);
  601.             HP26_move(x-htic, y);
  602.             HP26_vector(x+htic, y);
  603.             break;
  604.         case 6:
  605.             /* do X */
  606.             HP26_move(x+htic, y+vtic);
  607.             HP26_vector(x-htic, y-vtic);
  608.             HP26_move(x-htic, y+vtic);
  609.             HP26_vector(x+htic, y-vtic);
  610.             break;
  611.         default:
  612.             /* do diamond */
  613.             HP26_move(x, y-vtic);
  614.             HP26_vector(x-htic, y);
  615.             HP26_vector(x, y+vtic);
  616.             HP26_vector(x+htic, y);
  617.             HP26_vector(x, y-vtic);
  618.             break;
  619.     }
  620.     return(TRUE);
  621. }
  622.